package com.googlecode.dgwt.client.dijit.base.state;

import java.util.HashSet;
import java.util.Set;

import com.google.gwt.user.client.Event;
import com.googlecode.dgwt.client.dijit.Widget;

/**
 * @author wellsantos@wellsantos.com
 * @since 0.01
 */
public abstract class EventState extends WidgetState {

    private static final Set<EventState> allStates = new HashSet<EventState>();
    
    protected EventState() {
        allStates.add(this);
    }

    
    public abstract boolean isActivatedBy(Event event, int eventMask, Widget widget);
    public abstract boolean isDeactivatedBy(Event event, int eventMask, Widget widget);
    public abstract int getEventMask();


    public static EventState findById(int id) {
        WidgetState state = WidgetState.findById(id);
        return (EventState) (state instanceof EventState ? state : null);
    }
    
    public static Set<EventState> getAllEventStates() {
        return allStates;
    }
      
}
